﻿using System.Diagnostics.Contracts;
using System.Linq;
using System.Collections.Generic;
using CodeMinder.Output.Interface;
using CodeMinder.SCM.Interface;

namespace CodeMinder.Core
{
    public class GraphCreator
    {
        private readonly IEnumerable<ISourceControlProvider> _inputSources;
        private readonly IGraphOutput _outputSource;

        public GraphCreator(IEnumerable<ISourceControlProvider> inputSources, IGraphOutput outputSource)
        {
            Assure.ThatArgument(() => inputSources, p => p != null);
            Assure.ThatArgument(() => inputSources, p => p.Any());
            Assure.ThatArgument(() => outputSource, p => p != null);
            
            _inputSources = inputSources;
            _outputSource = outputSource;
        }

        public bool TryCreate()
        {
            if (!_inputSources.Any(i => i.IsValid))
                return false;

            return true;
        }
    }
}